<div class="events form">
<?php echo $form->create('Event');?>
	<fieldset>
 		<legend><?php __('Edit Event');?></legend>
	<?php
		echo $form->input('id');
		echo $form->input('title');
		echo $form->input('start_date');
		echo $form->input('end_date');
		echo $form->input('announcement_body');
		echo $form->input('content_body');
    	echo $form->select('attendance_manager_id', $organizers, NULL, array(), '-Attendance Manager-').'<br/>';
		echo $form->select('event_type_id', $selectEvents, NULL, array(), '-Event Type-');
		echo $form->input('member_price');
		echo $form->input('guest_price');
		echo $form->input('Instructor');

		//echo $form->input('season_id');
		//echo $form->input('is_closed');
		//echo $form->input('is_deleted');
		$i=0;
		foreach ($user_types as $user_type){		
			if ($user_type['UserType']['id'] < 4){			
				$i+=1;
    			continue;
			}
			
			echo $user_type['UserType']['title'].'<br />';
            echo $form->input('EventPrivilage.'.$i.'.id',array('type'=>'hidden','value'=>$this->data['EventPrivilage'][$i]['id']));
       		echo $form->input('EventPrivilage.'.$i.'.event_id',array('type'=>'hidden','value'=>$this->data['Event']['id']));
			echo $form->input('EventPrivilage.'.$i.'.user_type_id',array('type'=>'hidden','value'=>$user_type['UserType']['id']));
    		//echo the 2 check boxes
            if ($this->data["EventPrivilage"][$i]["privilage"][0] == '1')
                echo '<input type="checkbox" name ="data[EventPrivilage]['.$i.'][privilage-view]" id="view'.$i.'" checked>';
            else
                echo '<input type="checkbox" name ="data[EventPrivilage]['.$i.'][privilage-view]" id="view'.$i.'">';
            
            echo '<label for="view'.$i.'">view</label><br/>';

            if ($this->data["EventPrivilage"][$i]["privilage"][1] == '1')
                echo '<input type="checkbox" name ="data[EventPrivilage]['.$i.'][privilage-edit]" id="edit'.$i.'" checked>';
            else
                echo '<input type="checkbox" name ="data[EventPrivilage]['.$i.'][privilage-edit]" id="edit'.$i.'">';
            
            echo '<label for="edit'.$i.'">edit</label><br/>';
            
   			unset($this->data['EventPrivilage']['privilage']);
			$i+=1;
		}		
		
		
	?>
	</fieldset>
<?php echo $form->end('Submit');?>
</div>
<div class="actions">
	<ul>
		<li><?php echo $html->link(__('Delete', true), array('action' => 'delete', $form->value('Event.id')), null, sprintf(__('Are you sure you want to delete # %s?', true), $form->value('Event.id'))); ?></li>
		<li><?php echo $html->link(__('List Events', true), array('action' => 'index'));?></li>
	</ul>
</div>
